import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MemberPersonalVO, MemberPersonalForm, MemberPersonalQuery } from '@/api/primary/memberPersonal/types';

/**
 * 查询会员私教课关系列表
 * @param query
 * @returns {*}
 */

export const listMemberPersonal = (query?: MemberPersonalQuery): AxiosPromise<MemberPersonalVO[]> => {
  return request({
    url: '/primary/memberPersonal/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询会员私教课关系详细
 * @param memberId
 */
export const getMemberPersonal = (memberId: string | number): AxiosPromise<MemberPersonalVO> => {
  return request({
    url: '/primary/memberPersonal/' + memberId,
    method: 'get'
  });
};

/**
 * 新增会员私教课关系
 * @param data
 */
export const addMemberPersonal = (data: MemberPersonalForm) => {
  return request({
    url: '/primary/memberPersonal',
    method: 'post',
    data: data
  });
};

/**
 * 修改会员私教课关系
 * @param data
 */
export const updateMemberPersonal = (data: MemberPersonalForm) => {
  return request({
    url: '/primary/memberPersonal',
    method: 'put',
    data: data
  });
};

/**
 * 删除会员私教课关系
 * @param memberId
 */
export const delMemberPersonal = (memberId: string | number | Array<string | number>) => {
  return request({
    url: '/primary/memberPersonal/' + memberId,
    method: 'delete'
  });
};
